<nz-card [nzBordered]="false">
  <section class="search-section">
    <input nz-input placeholder="客户微信名、兑换产品" [(ngModel)]="keyword" class="search-item"/>
    <nz-select *ngIf="type == 1" [(ngModel)]="status" [nzPlaceHolder]="'状态'" class="search-item" [nzAllowClear]="true"
               [nzShowSearch]="true">
      <nz-option
        *ngFor="let option of statusOptions"
        [nzLabel]="option.value"
        [nzValue]="option.key">
      </nz-option>
    </nz-select>
    <nz-select *ngIf="type == 2" [(ngModel)]="status" [nzPlaceHolder]="'状态'" class="search-item" [nzAllowClear]="true"
               [nzShowSearch]="true">
      <nz-option
        *ngFor="let option of cashStatusOptions"
        [nzLabel]="option.value"
        [nzValue]="option.key">
      </nz-option>
    </nz-select>
    <button nz-button [nzType]="'primary'" nzGhost (click)="search()" class="search-item">
      <i class="anticon anticon-search"></i><span>搜索</span>
    </button>
  </section>
  <nz-table #nzTable [nzData]="page.content"
            [nzPageSize]="page.size"
            [nzTotal]="page.totalElements"
            [nzFrontPagination]="false"
            [(nzPageIndex)]="page.number"
            (nzPageIndexChange)="changePageNo($event)"
            [nzLoading]="isLoading">
    <thead>
    <tr>
      <th nz-th><span>序号</span></th>
      <th nz-th><span>客户微信名</span></th>
      <th nz-th><span>兑换产品</span></th>
      <th nz-th><span>需要积分/产品</span></th>
      <th nz-th><span>兑换数量</span></th>
      <th nz-th><span>使用总积分</span></th>
      <th nz-th><span>状态</span></th>
      <th *ngIf="type == 2"><span>失败原因</span></th>
      <th nz-th><span>申请时间</span></th>
      <th nz-th><span>操作</span></th>
    </tr>
    </thead>
    <tbody>
    <tr *ngFor="let data of nzTable.data;let i=index">
      <td>
        {{i+1}}
      </td>
      <td>{{data.cusName}}</td>
      <td [title]="data.productTitle">{{data.productTitle|stringEllipsisCutPipe:20}}</td>
      <td>{{data.needCredit}}({{data.creditType == 1?"普通积分":"TAK积分"}})</td>
      <td>{{data.quantity}}</td>
      <td>{{data.needTotalCredit}}({{data.creditType == 1?"普通积分":"TAK积分"}})</td>
      <td *ngIf="data.type == 1">{{data.status|dicsNamePipe:statusOptions}}</td>
      <td *ngIf="data.type == 2">{{data.status|dicsNamePipe:cashStatusOptions}}</td>
      <td *ngIf="type == 2">{{data.errCodeDes}}</td>
      <td>{{data.saveDate}}</td>
      <td>
        <a href="javascript:void (0);" (click)="editEntity(data)">查看详情</a>
        <span *ngIf="data.status == 1">
          <nz-divider nzType="vertical"></nz-divider>
          <nz-popconfirm [nzTitle]="'确定要同意兑换申请吗？'" (nzOnConfirm)="agree(data)">
            <a nz-popconfirm>通过</a>
          </nz-popconfirm>
          <nz-divider nzType="vertical"></nz-divider>
          <nz-popconfirm [nzTitle]="'确定要驳回该客户兑换申请吗？'" (nzOnConfirm)="reject(data)">
            <a nz-popconfirm>驳回</a>
          </nz-popconfirm>
        </span>
        <span *ngIf="data.status == 3 && data.type == 1">
          <nz-divider nzType="vertical"></nz-divider>
            <a href="javascript:void (0);" (click)="logistics(data)">确认发货</a>
        </span>
        <span *ngIf="data.status == 3 && data.type == 2">
          <nz-divider nzType="vertical"></nz-divider>
             <nz-popconfirm [nzTitle]="'确定重新发放现金吗？'" (nzOnConfirm)="reSend(data)">
              <a nz-popconfirm *ngIf="data.payStatus == 2 && data.amount != '0'">补发</a>
            </nz-popconfirm>
        </span>

      </td>
    </tr>
    </tbody>
  </nz-table>
</nz-card>
